package org.xw.dto;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.xw.pojo.UserPojo;

import java.io.Serializable;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class UserDto implements Serializable {
    private static final long serialVersionUID = 1L; // 通常放置在类的成员变量区域


    private Integer id;//主键id
    private String username;//用户昵称
    private String phone;//用户电话号码
    private String headImage;//用户头像
    private String address;//用户地址
    private String sex;//用户性别
    private Integer isBan;//用户是否被封禁（0：未被封禁，1：被封禁）
//    private String password;//用户登录密码


    public static UserDto toUser(UserPojo user) {
        UserDto dto = new UserDto();
        dto.id = user.getId();
        dto.username = user.getUsername();
        dto.phone = user.getPhone();
        dto.headImage = user.getHeadImage();
        dto.address = user.getAddress();
        dto.sex = user.getSex();
        dto.isBan = user.getIsBan();
        return dto;
    }
}
